<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/10/9
 * Time: 18:32
 */
class Circle{

    private  $r;

    public function  getArea()
    {
        return 3.14*$this->r*$this->r;

    }
    public function __set($name, $value)
    {
        if ($name=='r'&&$value<0){
            $this->r=0;
        }
        else
        {
            $this->$name=$value;
        }
        // TODO: Implement __set() method.
    }
    public function __get($name)
    {
        // TODO: Implement __get() method.
        return $this->$name;
    }
}
$c=new Circle();
$c->r=3;
print  $c->getArea();
print '</br>';

$c->r=-3;
print $c->getArea();